package com.fs.uc.base.repo;

import com.fs.uc.base.domain.FunctionalModule;
import io.quarkus.hibernate.orm.panache.PanacheRepository;

import javax.enterprise.context.ApplicationScoped;
import java.util.List;
import java.util.Set;

/**
 * @author 崔超
 * 2021/12/2
 */
@ApplicationScoped
public class ModuleRepository implements PanacheRepository<FunctionalModule> {
    final static String NAME_FIELD = "name";
    final static String FREE_FIELD = "free";

    public FunctionalModule findByName(String name) {
        return find(NAME_FIELD, name).firstResult();
    }

    public List<FunctionalModule> findFreeModules(){
        return list(FREE_FIELD, true);
    }

}
